package com.whisper.hfdp.design.observer.weather.display;

import com.whisper.hfdp.design.observer.weather.Observer;
import com.whisper.hfdp.design.observer.weather.Subject;

public class ForecastDisplay implements Observer, DisplayElement {

    private float pressure;

    private Subject weatherData;

    public ForecastDisplay(Subject weatherData) {
        this.weatherData = weatherData;
        weatherData.registerObserver(this);
    }

    @Override
    public void update(float temperature, float humidity, float pressure) {
        this.pressure = pressure;
        display();
    }

    @Override
    public void display() {
        System.out.println("forecast pressure ：" + pressure);
    }
}
